<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*
<span class='line'>  2</span> Copyright 2011, KISSY UI Library v1.1.5
<span class='line'>  3</span> MIT Licensed
<span class='line'>  4</span> build time: Sep 11 10:29
<span class='line'>  5</span> */</span><span class="WHIT">
<span class='line'>  6</span> </span><span class="COMM">/**
<span class='line'>  7</span>  * AJBridge Class
<span class='line'>  8</span>  * @author kingfo oicuicu@gmail.com
<span class='line'>  9</span>  */</span><span class="WHIT">
<span class='line'> 10</span> </span><span class="NAME">KISSY.add</span><span class="PUNC">(</span><span class="STRN">'gallery/form/1.2/uploader/plugins/ajbridge/ajbridge'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">S</span><span class="PUNC">,</span><span class="NAME">Flash</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 11</span> 
<span class='line'> 12</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ID_PRE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'#'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT">        </span><span class="NAME">VERSION</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'1.0.15'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">		</span><span class="NAME">PREFIX</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'ks-ajb-'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">		</span><span class="NAME">LAYOUT</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT">        </span><span class="NAME">EVENT_HANDLER</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'KISSY.AJBridge.eventHandler'</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// Flash 事件抛出接受通道</span><span class="WHIT">
<span class='line'> 17</span> 
<span class='line'> 18</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 19</span>      * @constructor
<span class='line'> 20</span>      * @param {String} id       注册应用容器 id
<span class='line'> 21</span>      * @param {Object} config   基本配置同 S.Flash 的 config
<span class='line'> 22</span>      * @param {Boolean} manual  手动进行 init
<span class='line'> 23</span>      */</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">    </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">AJBridge</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">,</span><span class="NAME">manual</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">        </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">id.replace</span><span class="PUNC">(</span><span class="NAME">ID_PRE</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 健壮性考虑。出于 KISSY 习惯采用 id 选择器</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">        </span><span class="NAME">config</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Flash._normalize</span><span class="PUNC">(</span><span class="NAME">config</span><span class="PUNC">||</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 标准化参数关键字</span><span class="WHIT">
<span class='line'> 27</span> 
<span class='line'> 28</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">            </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ID_PRE</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// 之所以要求使用 id，是因为当使用 ajbridge 时，程序员自己应该能确切知道自己在做什么</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">            </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">data.status</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">                    </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="STRN">'failed'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">				</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">                </span><span class="NAME">S.mix</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 37</span> 
<span class='line'> 38</span> </span><span class="WHIT">                </span><span class="COMM">// 执行激活 静态模式的 flash</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">                </span><span class="COMM">// 如果这 AJBridge 先于 DOMReady 前执行 则失效</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">                </span><span class="COMM">// 建议配合 S.ready();</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">data.dynamic</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">config.src</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">						</span><span class="NAME">self.activate</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">		</span><span class="COMM">// 自动产生 id	</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">		</span><span class="NAME">config.id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.id</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">S.guid</span><span class="PUNC">(</span><span class="NAME">PREFIX</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 48</span> 
<span class='line'> 49</span> </span><span class="WHIT">        </span><span class="COMM">// 注册应用实例</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">        </span><span class="NAME">AJBridge.instances</span><span class="PUNC">[</span><span class="NAME">config.id</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 51</span> 
<span class='line'> 52</span> </span><span class="WHIT">        </span><span class="COMM">//	动态方式</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">config.src</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">            </span><span class="COMM">// 强制打开 JS 访问授权，AJBridge 的最基本要求</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">            </span><span class="NAME">config.params.allowscriptaccess</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'always'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">            </span><span class="NAME">config.params.flashvars</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">S.merge</span><span class="PUNC">(</span><span class="NAME">config.params.flashvars</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">                </span><span class="COMM">// 配置 JS 入口</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">                </span><span class="NAME">jsEntry</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">EVENT_HANDLER</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">                </span><span class="COMM">// 虽然 Flash 通过 ExternalInterface 获得 obejctId</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">                </span><span class="COMM">// 但是依然存在兼容性问题, 因此需要直接告诉</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">                </span><span class="NAME">swfID</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">config.id</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 64</span> 
<span class='line'> 65</span> </span><span class="WHIT">        </span><span class="COMM">// 支持静态方式，但是要求以上三个步骤已静态写入</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">        </span><span class="COMM">// 可以参考 test.html</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">        </span><span class="COMM">// 由于完全基于事件机制，因此需要通过监听之后进行初始化 Flash</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">manual</span><span class="PUNC">)</span><span class="NAME">self.__args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">S.later</span><span class="PUNC">(</span><span class="NAME">Flash.add</span><span class="PUNC">,</span><span class="NAME">LAYOUT</span><span class="PUNC">,</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="NAME">Flash</span><span class="PUNC">,</span><span class="PUNC">[</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 73</span> 
<span class='line'> 74</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 75</span>      * 静态方法
<span class='line'> 76</span>      */</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">    </span><span class="NAME">S.mix</span><span class="PUNC">(</span><span class="NAME">AJBridge</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 78</span> 
<span class='line'> 79</span> </span><span class="WHIT">        </span><span class="NAME">version</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">VERSION</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 80</span> 
<span class='line'> 81</span> </span><span class="WHIT">        </span><span class="NAME">instances</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 82</span> 
<span class='line'> 83</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 84</span>          * 处理来自 AJBridge 已定义的事件
<span class='line'> 85</span>          * @param {String} id            swf传出的自身ID
<span class='line'> 86</span>          * @param {Object} event        swf传出的事件
<span class='line'> 87</span>          */</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">        </span><span class="NAME">eventHandler</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">instance</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">AJBridge.instances</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">instance</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">                </span><span class="NAME">instance.__eventHandler</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 94</span> 
<span class='line'> 95</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 96</span>          * 批量注册 SWF 公开的方法
<span class='line'> 97</span>          * @param {Class} C
<span class='line'> 98</span>          * @param {String|Array} methods
<span class='line'> 99</span>          */</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">        </span><span class="NAME">augment</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">methods</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">S.isString</span><span class="PUNC">(</span><span class="NAME">methods</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">                </span><span class="NAME">methods</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">methods</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isArray</span><span class="PUNC">(</span><span class="NAME">methods</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">			</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">			</span><span class="WHIT">
<span class='line'>107</span> 
<span class='line'>108</span> </span><span class="WHIT">            </span><span class="NAME">S.each</span><span class="PUNC">(</span><span class="NAME">methods</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">methodName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">                </span><span class="NAME">C.prototype</span><span class="PUNC">[</span><span class="NAME">methodName</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">                    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.callSWF</span><span class="PUNC">(</span><span class="NAME">methodName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">S.makeArray</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// 当 swf 异常时，进一步捕获信息</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">                        </span><span class="NAME">this.fire</span><span class="PUNC">(</span><span class="STRN">'error'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>119</span> 
<span class='line'>120</span> </span><span class="WHIT">    </span><span class="NAME">S.augment</span><span class="PUNC">(</span><span class="NAME">AJBridge</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">S.EventTarget</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>121</span> 
<span class='line'>122</span> </span><span class="WHIT">        </span><span class="NAME">init</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.__args</span><span class="PUNC">)</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">            </span><span class="NAME">Flash.add.apply</span><span class="PUNC">(</span><span class="NAME">Flash</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.__args</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">			</span><span class="NAME">this.__args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">			</span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">this.__args</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 防止重复添加</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>128</span> 
<span class='line'>129</span> </span><span class="WHIT">        </span><span class="NAME">__eventHandler</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>130</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT">                </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">event.type</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">			</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">            </span><span class="NAME">event.id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT">   </span><span class="COMM">//	弥补后期 id 使用</span><span class="WHIT">
<span class='line'>134</span> </span><span class="WHIT">            </span><span class="KEYW">switch</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>135</span> </span><span class="WHIT">				</span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"log"</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">					 </span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">event.message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">					</span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">				</span><span class="KEYW">default</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">					</span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">			</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>143</span> 
<span class='line'>144</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>145</span>          * Calls a specific function exposed by the SWF's ExternalInterface.
<span class='line'>146</span>          * @param func {String} the name of the function to call
<span class='line'>147</span>          * @param args {Array} the set of arguments to pass to the function.
<span class='line'>148</span>          */</span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT">        </span><span class="NAME">callSWF</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">func</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">            </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">            </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.swf</span><span class="PUNC">[</span><span class="NAME">func</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self.swf</span><span class="PUNC">[</span><span class="NAME">func</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">apply</span><span class="PUNC">(</span><span class="NAME">self.swf</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">            </span><span class="COMM">// some version flash function is odd in ie: property or method not supported by object</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">            </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">args.length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">                    </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"'"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">args.join</span><span class="PUNC">(</span><span class="STRN">"','"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"'"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">                </span><span class="COMM">//avoid eval for compressiong</span><span class="WHIT">
<span class='line'>164</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Function</span><span class="PUNC">(</span><span class="STRN">'self'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'return self.swf.'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">func</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'('</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">');'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> 
<span class='line'>169</span> </span><span class="WHIT">    </span><span class="COMM">// 为静态方法动态注册</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">    </span><span class="COMM">// 注意，只有在 S.ready() 后进行 AJBridge 注册才有效。</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">    </span><span class="NAME">AJBridge.augment</span><span class="PUNC">(</span><span class="NAME">AJBridge</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">'activate'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'getReady'</span><span class="PUNC">,</span><span class="STRN">'getCoreVersion'</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> 
<span class='line'>173</span> </span><span class="WHIT">    </span><span class="NAME">window.AJBridge</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">S.AJBridge</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">AJBridge</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>174</span> 
<span class='line'>175</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">AJBridge</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>176</span> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">requires</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="STRN">"flash"</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>177</span> </span><span class="COMM">/**
<span class='line'>178</span>  * NOTES:
<span class='line'>179</span>  * 20120117 移植成kissy1.2.0的模块（明河修改）
<span class='line'>180</span>  */</span><span class="WHIT">
<span class='line'>181</span> </span></pre></body></html>